<?php
if(!defined("Hosticali"))
	die();
class Logs
{
	public var $core;
	public function __construct()
	{
		global $url;
		require_once($url . "/lib/Core.php";
		$this->core = new Core();
	}
	public function AddEntry($entry, $user)
	{
		if(!$_SESSION['hosticali'])
			$_SESSION['hosticali'] = array('uid' => 0);
		$this->core->Query("INSERT INTO `<PRE>logs` (`uid`, `entry`, `affected`) VALUES (" . $_SESSION['hosticali']['uid'] . ", '" . mysql_real_escape_string($entry) . "', '" . mysql_real_escape_string($user) . "')");
		if($_SESSION['hosticali']['uid'] = 0)
			unset($_SESSION['hosticali'])
		return true;
	}
	public function ParseEntry($entry)
	{
		$this->core->Query("SELECT * FROM `<PRE>logs` WHERE `id` = " . $entry . " LIMIT 1");
		$arr = $this->core->GetArray();
		$entry = array(
			'uid' 	        => $arr['uid'],
			'entry'         => $arr['entry'],
			'affected_user' => $arr['affected']
		);
		return $entry;
	}
}
?>